#!/usr/bin/env bash

RESOURCE_NAME=oxueo-api-0.0.1-SNAPSHOT.jar

tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
#echo 'Kill Process!'
kill -9 $tpid
#else
#echo 'Stop Success!'
fi

#tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
#if [ ${tpid} ]; then
#    echo 'App is running.'
#else
#    echo 'App is NOT running.'
#fi

rm -f tpid
nohup /home/jdk1.8.0_60/bin/java -jar ./$RESOURCE_NAME --spring.profiles.active=prod &
#echo $! > tpid
#echo Start Success!
#tail -f nohup.out
